<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include/common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Edu05</title>
</head>
<body>
<script>
	function callAjax(){
		var operator = document.getElementById("operator").value;
		var num1 = parseInt(document.getElementById("num1").value);
		var num2 = parseInt(document.getElementById("num2").value);
		var arrParamId = ["operator", "num1", "num2"];
		var arrParamValue = [operator, num1, num2];
		var ajaxObj = new Ajax();
		ajaxObj.doSend("POST", "edu05", arrParamId, arrParamValue, "returnBack", true);
		
	}
	
	function returnBack(){
		document.getElementById("result").value = this.xmlHttpObj.responseText;
	}
</script>
<input type="text" name="num1" id="num1">
<select name="operator" id="operator">
	<option value="+">+</option>
	<option value="-">-</option>
	<option value="*">*</option>
	<option value="/">/</option>
	<option value="%">%</option>
</select>

<input type="text" name="num2" id="num2">=
<input type="text" name="result" id="result"><p>
<input type="button" value="계산" onclick="callAjax()"> 
</body>
</html>